#include "GLSLShaderProgram.h"

namespace lib3dw
{
	GLSLShaderProgram::GLSLShaderProgram(std::string shaderName, const char* vertexShaderFile, const char* fragmentShaderFile)
	{
		vertexShader = new GLSLShader(vertexShaderFile , GL_VERTEX_SHADER);
		fragmentShader = new GLSLShader(fragmentShaderFile, GL_FRAGMENT_SHADER);

		name = shaderName;
	}

	GLSLShaderProgram::~GLSLShaderProgram()
	{
		delete vertexShader;
		delete fragmentShader;
	}
	
	void GLSLShaderProgram::Link()
	{
		id = glCreateProgram();
		glAttachShader(id, vertexShader->GetShaderID());
		glAttachShader(id, fragmentShader->GetShaderID());

		glLinkProgram(id);
	}
	
	const GLuint GLSLShaderProgram::GetId() const
	{
		return id;
	}
	
	const std::string GLSLShaderProgram::GetName() const
	{
		return name;
	}
}